{% extends "view/admin/ext_admin.html" %}

{% block extadmin %}
<section class="panel panel-default">
    <header class="panel-heading text-right bg-light  clearfix">
        <ul class="nav nav-tabs pull-left">
            <li class=""><a  href="/{{ctx.controller}}/index">{{controller.meta_title}}</a></li>
            <li class="active"><a  href="/{{ctx.controller}}/temp">模板设置</a></li>
        </ul>
        <!--<span class="hidden-sm"><a href="/{{http.module}}/{{http.controller}}/ajaxadd" class="text-info " data-toggle="ajaxModal">添加友情链接</a></span>-->
    </header>
    <div class="row wrapper">

        <div class="col-sm-12 m-b-xs">
            <a href="/{{ctx.controller}}/addtemp" class="btn btn-s-md btn-primary">添加广告模板</a>
            <a href="/{{ctx.controller}}/adcache" class="btn btn-s-md btn-dark ajax-get">更新广告缓存</a>
        </div>
    </div>
    <div class="table-responsive">
        <table class="table table-striped b-t b-light">
            <thead>
            <tr>
                <th style="width:20px;"><label class="checkbox m-n i-checks"><input type="checkbox"><i></i></label></th>
                <th style="">模板名称</th>
                <th class="">可用广告类型</th>
                <th >操作</th>
            </tr>
            </thead>
            <tbody>
            {% for item in list %}
            <tr>
                <td><label class="checkbox m-n i-checks"><input class="ids" type="checkbox" name="ids" value="{{item.tempid}}"><i></i></label></td>
                <td>{{item.title}}[{{item.name}}]</td>
                <td>
                    {%for v,k in item.type|strToJson%}
                    {%if k =="1"%}
                    {%if v=='images'%}
                    图片
                    {%elif v=='flash'%}
                    动画
                    {%elif v=='text'%}
                    文字
                    {%else%}
                    代码
                    {%endif%}
                    {%endif%}
                    {%endfor%}
                </td>
                <td>
                    <a href="/{{ctx.controller}}/edittemp/?tempid={{item.tempid}}" class="text-info" >修改</a>
                    <a href="/{{ctx.controller}}/deltemp/?ids={{item.tempid}}" class="confirm ajax-get text-info">删除</a>
                </td>


            </tr>
            {% else %}
            <tr><td colspan="8"><div class="alert alert-warning alert-block">
                <button data-dismiss="alert" class="close" type="button">×</button>
                <p>This would display if the 'item' collection were empty</p>
            </div></td></tr>

            {% endfor %}


            </tbody>
        </table>
    </div>
    <footer class="panel-footer">
        <div class="row">

            <div class="col-sm-6 text-center-xs">
                <div class="btn-group">
                    <a href="/{{ctx.controller}}/deltemp" class="btn btn-default ajax-post confirm" target-form="ids">删除选定广告位</a>
                </div>
            </div>

            <div class="col-sm-6 text-right text-center-xs">
                {{pagerData | safe}}
            </div>
        </div>
    </footer>
</section>

{% endblock %}

